#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#define max(x,y) (x<y?x:y)
int main(void)
{
	int a = 0, b = 0, c = 0,i=0;
	scanf("%d %d", &a, &b);
	c = max(a, b);
	for (i = c; i > 1; i--)
		if (a % i == 0 && b % i == 0)
			break;
		printf("%d", i);
	return 0;
}